import request from "../utils/request";
import dayjs from "dayjs";

export function login(data) {
  return request({
    url: "http://121.89.205.189:3000/admin/admin/login",
    method: "POST",
    data: data
  });
}

// 主页电影列表电影
export function getMovies(params) {
  return request({
    method: "get",
    params: params,
    headers: {
      "X-Host": "mall.film-ticket.film.list",
    },
  });
}

// 获取全部影院信息
export function getCinema(params) {
  return request({
    method: "get",
    params: params,
    headers: {
      "X-Host": "mall.film-ticket.cinema.list",
    },
  });
}

// 具体一个电影的详情
export function getDetail(params) {
  return request({
    method: "get",
    params: params,
    headers: {
      "X-Host": "mall.film-ticket.film.info",
    },
  });
}

// 获取其中一个影院里面得--详细信息
export function getCinemaInfo(params) {
  return request({
    method: "get",
    params: params,
    headers: {
      "X-Host": "mall.film-ticket.cinema.info",
    },
  });
}

// 获取其中一个影院里面得推荐的--电影数据
export function getshowFilm(params) {
  return request({
    method: "get",
    params: params,
    headers: {
      "X-Host": "mall.film-ticket.film.cinema-show-film",
    },
  });
}

// 获取某个电影的放映时间
export function getscheduleList(params) {
  return request({
    method: "get",
    params: params,
    headers: {
      "X-Host": "mall.film-ticket.schedule.list",
    },
  });
}

// 获取资讯数据
export function getAct() {
  return request({
    method: "get",
    baseURL: "https://m.maizuo.com/gateway?actId=ElzMZU125260",
    headers: {
      "X-Host": "mall.act.static-page.info",
    },
  });
}

// 获取顶部tab里面的日期 showCinemas=> showDate
export function getCinemaDate(params) {
  return request({
    method: "get",
    params: params,
    headers: {
      "X-Host": "mall.film-ticket.cinema.film-show-cinema"
    }
  })
}

// 影院列表接口
export function batchCinema(data) {
  return request({
    method: "post",
    data: data,
    headers: {
      "X-Host": "mall.film-ticket.cinema.batch-cinema",
    }
  })
}

// 推荐城市
export function getRecommend(params) {
  return request({
    method: "get",
    params: params,
    headers: {
      "X-Host": "mall.film-ticket.cinema.recommend",
    }
  })
}

export function getCity() {
  return request({
    method: "get",
    headers: {
      "X-Host": "mall.film-ticket.city.list",
    }
  })
}

// 时间戳方法
export function parseTimestamp(time, type) {
  return dayjs.unix(time).format(type);
}
